#   
# Create bootstraper
#

!IF "$(BUILD)" != "Release" && "$(BUILD)" != "Debug"
!ERROR You must define "BUILD=Release" or "BUILD=Debug"
!ENDIF 

!IF "$(BUILDDIR)" == ""
!ERROR You must define BUILDDIR to specify the build output directory.
!ENDIF 

!IF "$(BUILD)" == "Release"
DEBUG=0 
!ENDIF 
!IF "$(BUILD)" == "Debug"
DEBUG=1
!ENDIF

WIX3_SETUP          = wix-3-setup\setup.exe
WIX3_SETUPBLD       = wix-3-setup\setupbld.exe
WSSE_NAME   = WebSlideShowExtensionForInternetExplorerSetup
WSSE_MSI    = $(BUILDDIR)\$(WSSE_NAME).msi
WSSE_EXE    = $(BUILDDIR)\$(WSSE_NAME).exe

all: $(WSSE_EXE) 

clean:
    @if exist "$(WSSE_EXE)" del "$(WSSE_EXE)"
    @if exist "$(BUILDDIR)\setup.exe" del "$(WSSE_EXE)"

$(WSSE_EXE): $(WSSE_MSI)
    copy "$(WIX3_SETUP)" "$(BUILDDIR)\setup.exe"
    mt.exe -manifest AdminRights.manifest -outputresource:"$(BUILDDIR)\setup.exe"
    $(WIX3_SETUPBLD) -out "$(WSSE_EXE)" -msi "$(WSSE_MSI)" -setup "$(BUILDDIR)\setup.exe"
    del "$(BUILDDIR)\setup.exe"
